<?php
/**
 * @version     1.0.0
 * @package     com_general
 * @copyright   Copyright (C) 2013. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      kent <kent@viseed.com> - http://viseed.com
 */
// no direct access
defined('_JEXEC') or die;

//Load admin language file
$lang = JFactory::getLanguage();
$lang->load('com_general', JPATH_ADMINISTRATOR);

$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
$cat_menu = get_cat_from_parent(19);
$handbook_id = JRequest::getVar('id','','int');
$handbook_info = get_cat_title_from_article($handbook_id);
$db = JFactory::getDbo();
$db->setQuery('select * from #__content as c INNER JOIN spj_categories as ca on c.catid = ca.id and ca.parent_id=19 and c.state = 1');
$db->query();
$first_article = $db->loadObject();
?>
 <link rel='stylesheet' type='text/css' href='<?php echo $templateDir;?>/js/cssmenu/styles.css' />

	<script type='text/javascript' src='<?php echo $templateDir;?>/js/cssmenu/menu_jquery.js'></script>
<script type="text/javascript">
    jQuery('#slidecaption').hide();
</script>
<div class="blue_line2">
	<div class="path">
<a href="#">Home</a> &gt; Handbook
</div>
</div>

<div class="inner_content">
	<div class="content">
	  <div class="tour_container">
    	<div class="about_left">
         <div id='cssmenu'>
<ul>
    <?php foreach($cat_menu as $index=>$obj_cat){
            if($index==0){
                $class='active';
            }else{
                $class='';
            }
            $article = check_cat_have_article($obj_cat->id);            
            if(!$article){
        ?>
   <li class='<?php echo $class;?>'><a href='javascript:voi(0);'><span><?php echo $obj_cat->title;?></span></a></li>
            <?php }else{?>
    <li class='<?php echo $class;?> <?php echo 'has-sub';?>'>
        <a href='javascript:voi(0);'><span><?php echo $obj_cat->title;?></span></a>
        <ul>
            <?php foreach($article as $index=>$obj){?>
            <li><a href='<?php echo JRoute::_('index.php?option=com_general&view=handbook&id='.$obj->id.'&Itemid=144')?>'><span><?php echo $obj->title;?></span></a></li>
            <?php }?>
        </ul>
    </li>
            <?php }?>
    <?php }?>
<!--   <li class='has-sub'><a href='#'><span>Products</span></a>
      <ul>
         <li><a href='#'><span>Widgets</span></a></li>
         <li><a href='#'><span>Menus</span></a></li>
         <li class='last'><a href='#'><span>Products</span></a></li>
      </ul>
   </li>
   <li class='has-sub'><a href='#'><span>Company</span></a>
      <ul>
         <li><a href='#'><span>About</span></a></li>
         <li class='last'><a href='#'><span>Location</span></a></li>
      </ul>
   </li>
   <li class='last'><a href='#'><span>Contact</span></a></li>-->
</ul>
</div>
   	  </div>
        
        <div class="about_right">
            <?php 
               if(empty($handbook_id)){
                    echo $first_article->introtext;
                }else{
                    $handbook_id = get_cat_title_from_article($handbook_id);
                    echo $handbook_info->introtext;
                }
            ?>
            
        </div>
        <br class="clear" />
    </div>
	</div>
</div>